﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GalaSoft.MvvmLight;
using System.Windows.Input;
using GalaSoft.MvvmLight.Command;
using System.Windows;

namespace TraceInspector.ViewModel
{
    public class ToolViewModel : ViewModelBase, TraceInspector.ViewModel.IToolViewModel
    {
        private readonly IToolManager _toolManager;
        private String title;
        private bool _isVisible = true;

        public String Title
        {
            get { return title; }
            set { title = value; RaisePropertyChanged("Title"); }
        }

        public bool IsVisible
        {
            get { return _isVisible; }
            set { _isVisible = value; RaisePropertyChanged("IsVisible"); }
        }

        
        private ICommand _closeCommand = null;

        public ICommand CloseCommand
        {
            get
            {
                return _closeCommand ?? (_closeCommand = new RelayCommand(Close));
            }
        }
        
        public ToolViewModel(IToolManager toolManager)
        {
            _toolManager = toolManager;
        }

        protected void Close()
        {
            if (CanClose)
            {
                _toolManager.CloseTool(this);    
            }
            
        }

        private bool canClose = true;

        public bool CanClose
        {
            get { return canClose; }
            set { canClose = value; }
        }



        

        

        
    }
}
